// File Name: adc_ctrl.h
// Author: kukukukuku~
// Date: 2024-06-26

#ifndef __ADC_CTRL_H
#define __ADC_CTRL_H

#include "at32f421.h"

//#define ADC_DRIVER_GPIO_CRM         CRM_GPIOA_PERIPH_CLOCK
//#define ADC_DRIVER_GPIO_PORT        GPIOA
//#define ADC_DRIVER_GPIO_PIN         GPIO_PINS_6

#define ADC_DMA_CRM                 CRM_DMA1_PERIPH_CLOCK
#define ADC_DMA_CH                  DMA1_CHANNEL1
#define ADC_DMA_FDT_FLAG            DMA1_FDT1_FLAG
#define ADC_DMA_IRQ                 DMA1_Channel1_IRQn
#define ADC_DMA_HANDLE              DMA1_Channel1_IRQHandler

#define ADC_CRM                     CRM_ADC1_PERIPH_CLOCK
#define ADC_CH_TEMPERATURE          ADC_CHANNEL_16
#define ADC_SEQUENCE_TEMPERATURE    (1)
#define ADC_IRQ                     ADC1_CMP_IRQn
#define ADC_HANDLE                  ADC1_CMP_IRQHandler

#define ADC_CH_NUM                  (1)
#define ADC_CH_TEMPERATURE_INDEX    (0)

extern uint16_t adcData[ADC_CH_NUM];   //ADC数据

extern double temperature; //温度值

//ADC配置
void adc_config(void);

#endif //__ADC_CTRL_H
